package org.example.ui.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import lombok.RequiredArgsConstructor;
import org.example.application.UrlShortenerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping()
@Tag(name = "短链接跳转模块" ,description = "短链接跳转功能")
@RequiredArgsConstructor
public class RestoreUrlController {
    private final UrlShortenerService urlShortenerService;

    @GetMapping("/{short-uri}")
    @Operation(summary = "短链接跳转原始链接")
    public void restoreUrl(@PathVariable("short-uri") String shortUri, ServletRequest request, ServletResponse response) {
        urlShortenerService.restoreUrl(shortUri, request, response);
    }
}
